#include "const.h"

void b_close(buffer_t b) {
	if (b->source) {
		i_delete((void *)b->source);
		b->source = (char *)0;
	}

	if (b->prev)
		b->prev->next = b->next;
	if (b->next)
		b->next->prev = b->prev;

	if (g_buf_head==b)
		g_buf_head = b->next;
	if (g_buf_tail==b)
		g_buf_tail = b->prev;

	i_delete((void *)b);
}
